﻿using System.Linq.Expressions;

namespace AME.Repositories;

public interface IBaseRepository<T> where T : class, new()
{
    Task<bool> AddAsync(T entity);
    Task<bool> AddRangeAsync(List<T> entities);
    Task<bool> UpdateAsync(T entity);
    Task<bool> DeleteByIdAsync(object id);
    Task<bool> DeleteAsync(Expression<Func<T, bool>> whereExpression);
    Task<T> GetByIdAsync(object id);
    Task<List<T>> GetListAsync(Expression<Func<T, bool>> whereExpression);
    Task<List<T>> GetAllAsync();
    Task<bool> AnyAsync(Expression<Func<T, bool>> whereExpression);
    Task<T> GetSingleAsync(Expression<Func<T, bool>> whereExpression);
    Task<(List<T> Data, int Total)> GetPagedListAsync(Expression<Func<T, bool>> whereExpression, int pageIndex, int pageSize);
}